export default class GameOver extends Laya.Script {

    constructor() { 
        super(); 
            /** @prop {name:btn_on, tips:"字符串类型示例", type:Node, default:null}*/
    this.btn_on=null;
        /** @prop {name:btn_off, tips:"字符串类型示例", type:Node, default:null}*/
        this.txt_on=null;
        // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    }
    onAwake(){
        Laya.stage.on("GameOver",this,this.gameOver);

        this.owner.getChildByName("btn_play").on(Laya.Event.CLICK,this,function(){
            Laya.SoundManager.playSound("res/Sounds/btn.WAV",1);
            Laya.timer.resume();
            this.owner.visible=false;
            Laya.stage.event("StartPlay");
            })
            this.btn_off.on(Laya.Event.CLICK,this,this.bntoff);
            this.btn_on.on(Laya.Event.CLICK,this,this.bnton);
        
    }
    bntoff(){
        Laya.SoundManager.playSound("res/Sounds/btn.WAV",1);
        this.btn_off.visible=false;
        this.btn_on.visible=true;
        Laya.SoundManager.muted=false;
        }
    bnton(){
        this.btn_on.visible=false;
        this.btn_off.visible=true;
        Laya.SoundManager.playSound("res/Sounds/btn.WAV",1);
        Laya.SoundManager.muted=true;
        }
    gameOver(){
        this.owner.visible=true;
    }
}